﻿using Uber.Core;
using Uber.Core.Model;
using Uber.Core.Repository;
using Uber.Core.Service;

namespace Uber.Service
{
    public class FillPayRequests : IFillPayRequests
    {
        private readonly IFillPayRequestRepo repo;

        public FillPayRequests(IFillPayRequestRepo repo)
        {
            this.repo = repo;
        }

        public bool Fill(long id, string transactionId)
        {
            return repo.Fill(id, transactionId).Equals(1);
        }


        public IPageable<FillPayRequest> GetPage(int page, int pageSize)
        {
            return new Pageable<FillPayRequest>
            {
                Page = repo.GetPage(page, pageSize, null, null),
                PageCount = ServiceUtils.GetPageCount(pageSize, repo.Count(null, null))
            };
        }

        public FillPayRequest Get(long id)
        {
            return repo.Get(id);
        }
    }
}